package tinybase.sm;

import tinybase.basic.RedBase.AttrType;
import tinybase.basic.RedBase.CompOp;

public class Node {
	public static final int N_CREATETABLE = 0;
	public static final int N_CREATEINDEX = 1;
	public static final int N_DROPTABLE = 2;
	public static final int N_DROPINDEX = 3;
	public static final int N_LOAD = 4;
	public static final int N_SET = 5;
	public static final int N_HELP = 6;
	public static final int N_PRINT = 7;
	public static final int N_QUERY = 8;
	public static final int N_INSERT = 9;
	public static final int N_DELETE = 10;
	public static final int N_UPDATE = 11;
	public static final int N_RELATTR = 12;
	public static final int N_CONDITION = 13;
	public static final int N_RELATTR_OR_VALUE = 14;
	public static final int N_ATTRTYPE = 15;
	public static final int N_VALUE = 16;
	public static final int N_RELATION = 17;
	public static final int N_STATISTICS = 18;
	public static final int N_LIST = 19;

	int kind;
	Object content;
	
	public Node(int kind, Object obj) {
		this.kind = kind;
		this.content = obj;
	}
}

class CREATETABLE {
	public String relname;
	public Node attrlist;
}

class CREATEINDEX {
	public String relname;
	public String attrname;
}

class DROPINDEX {
	public String relname;
	public String attrname;
}

class DROPTABLE {
	public String relname;
}

class LOAD {
	public String relname;
	public String filename;
}

class SET {
	public String paramName;
	public String string;
}

class HELP {
	public String relname;
}

class PRINT {
	public String relname;
}

class QUERY {
	public Node relattrlist;
	public Node rellist;
	public Node conditionlist;
}

class INSERT {
	public String relname;
	public Node valuelist;
}

class DELETE {
	public String relname;
	Node conditionlist;
}

class UPDATE {
	public String relname;
	public Node relattr;
	public Node relorvalue;
	public Node conditionlist;
}

class RELATTR {
	public String relname;
	public String attrname;
}

class CONDITION {
	public Node lhsRelattr;
	public Node rhsRelattr;
	public Node rhsValue;
	public CompOp op;
}

class RELATTR_OR_VALUE {
	public Node relattr;
	public Node value;
}

class ATTRTYPE {
	public String attrname;
	public String type;
}

class VALUE {
	public AttrType type;
	public Object val;
}

class RELATION {
	public String relname;
}

class LIST {
	public Node curr;
	public Node next;
}
